﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using PBOffice.Models;

namespace PBOffice.DAL
{
    public class TableTypeService
    {
        public List<TableType> GetAllTableType()
        {
            string sql = "select * from TableType";
            List<TableType> list = new List<TableType>();
            using (SqlDataReader dr = SqlHelp.ExecuteReader(SqlHelp.connectionstring, CommandType.Text, sql))
            {
                while (dr.Read())
                {
                    TableType type = new TableType();
                    type.TypeId = (int)dr["TypeId"];
                    type.TypeName = dr["TypeName"].ToString();
                    list.Add(type);
                }
            }
            return list;
        }
    }
}
